package com.fengpt.shardingjdbc.mapper;

import com.fengpt.shardingjdbc.dto.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

/**
 * @author fengpt
 * @createTime 2020年04月02日 11:30:00
 */
public interface UserMapper {
    @Select({
            "select * from user where id=#{id}"
    })
    User findUserById(@Param("id") Long id);

    @Select({
            "<script>",
            "SELECT * FROM `user` WHERE id in ",
            "<foreach item=\"item\" index=\"index\" collection=\"ids\" open=\"(\" separator=\",\" close=\")\">",
            "   #{item}",
            "</foreach>",
            "</script>",
    })
    List<User> findUserList(@Param("ids") List<Long> ids);
}
